#pragma once

#ifndef _GUICONVEYOR_H
#define _GUICONVEYOR_H

#include "Enums.h"

#include "GUIConveyorInterface.h"
#include "GUIBase.h"
#include "Part.h"
#include "Kit.h"
#include "KitRecipe.h"
#include "ConveyorAgent.h"

#include <Qlist.h>
#include <list>
#include <qpoint.h>
#include <qdebug.h>

using std::list;

#define LANE_LENGTH 325
#define KIT_X_OFFSET 10
#define DISTANCE_BETWEEN_KITS 10

class Kit;
class ConveyorAgent;

class GUIConveyor : public GUIBase
{
public:
	GUIConveyor(int startX, int startY, const ConveyorType conveyorType);
	~GUIConveyor();
	
	void setAgent(ConveyorAgent* agent);

	void DoCreateKit(KitRecipe*);
	void DoSendKitOut(Kit* kit);
	void DoKitTaken();
	void DoPurgeKit();

	void DoBreak();
	void DoFix();

	void advance(int phase);

	QPoint getPickUpKitPosition();
	QPoint getDropOffKitPosition();

protected:
	list<KitRecipe*> kitRecipes;
	list<Kit*> kits;

private:
	ConveyorAgent* agent;
	const ConveyorType conveyorType;
	
	QGraphicsPixmapItem *conveyorLines;

	bool laneMoving;

	// Alex Silkin: helps line things up with Kits. NEVER USE THE ACTUAL VARIABLES USE THE FUNCTIONS INSTEAD!!!
	int kitWidth;
	int kitHeight;

	int getKitWidth(); 
	int getKitHeight();
};

#endif